import Cookies from 'js-cookie'
import { getUrlKey } from '@/utils/urlParse'

const TokenKey = 'Admin-Token'

export function getToken() {
  const token = getUrlKey('token')
  if (token) {
    return token
  }
  return Cookies.get(TokenKey)
}

export function getCookieToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}
